//
//  Player+Protocol.swift
//  UILibrarysKit
//
//  Created by TSYH on 2024/6/4.
//

import Foundation

public protocol VideoPlayerControlView where Self: UIView {
    var ownerPlayer: VideoPlayer? { get set }
    
    /// 是否支持双击控制播放
    var enablePlayControlGestures: Bool { get }
    
    /// 播放器状态变化
    func player(_ player: VideoPlayer, stateChanged state: MinePlayerState)
        
    /// 缓存进度变化
    func player(_ player: VideoPlayer, didLoad duration: TimeInterval, total: TimeInterval)
    
    /// 播放进度变化
    func player(_ player: VideoPlayer, timeDidChange current: TimeInterval, total: TimeInterval)
    
    /// 快进 || 快退
    func player(_ player: VideoPlayer, seekTo target: TimeInterval, total: TimeInterval, isAdd: Bool)
    
    /// 控制面板显隐
    func player(_ player: VideoPlayer, toggleShow animated: Bool)
    
    /// 屏幕方向切换
    func player(_ player: VideoPlayer, orientationChangeTo isLandscape: Bool)
    
    /// 播放资源变化变化
    func player(_ player: VideoPlayer, resourceChanged resource: BMPlayerResource)
}

public protocol VideoPlayerDelegate: NSObjectProtocol {
    /// 播放状态变化
    func player(_ player: VideoPlayer, playerStateDidChange state: MinePlayerState)
    
    /// 加载进度变化
    func player(_ player: VideoPlayer, loadedTimeDidChange loadedDuration: TimeInterval, totalDuration: TimeInterval)
    
    /// 播放进度变化
    func player(_ player: VideoPlayer, playTimeDidChange currentTime: TimeInterval, totalTime: TimeInterval)
    
    ///播放器下滑
    func playerSwipeDown()
}
